home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12222 < prev    next >
Encoding:
Text File  |  1996-08-05  |  863 b   |  36 lines

  1. Path: btree.is.brooktree.com!usenet
  2. From: sasha@brooktree.com (Alex Bakaev)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Forced override?
  5. Date: Mon, 18 Mar 1996 18:58:21 GMT
  6. Organization: Brooktree Corporation
  7. Message-ID: <4ikbl1$4tc@btree.brooktree.com>
  8. References: <m1ybpgkvpa.fsf@zoger.ipost.com>
  9. NNTP-Posting-Host: komissar.is.brooktree.com
  10. X-Newsreader: Forte Free Agent v0.46
  11.  
  12. bobg@zoger.ipost.com (Bob Glickstein) wrote:
  13.  
  14. >Quick question: is it possible to declare a virtual member function in
  15. >such a way that derived classes are *required* to override it?  This
  16. >would have to work for classes both directly and indirectly derived.
  17.  
  18. >Thanks in advance.
  19.  
  20. Pure virtual functions are doing just that :
  21.  
  22. class SomeClass {
  23.    public:
  24.       virtual SomePureFunc() = 0;
  25. };
  26.  
  27. class SomeDerived : public SomeClass
  28. {
  29.    public:
  30.    virtual SomePureFunc();
  31. };
  32.  
  33. HTH, Alex
  34.  
  35.  
  36.